import { Home } from '../../pages/home/home-model.js';
var home = new Home();
Component({
  properties: {
    param: { //广告参数
      type: Object,
      value: ''
    },
  },
  data: {
   
  },

  ready: function () {
    this.getAd();
  },

  /**
   * 组件的方法列表
   */
  methods: {
    getAd: function () {
      var that = this;
      home.adv(this.data.param, (data) => {
        console.log(data);
        if(data.items.length > 0){
          that.setData({
            showAd: true,
            modelImage: data.items[0].image,
            modelUrl: data.items[0].url
          });
        }
        
      });
    },
    hiddenModel: function () {
      this.setData({
        showAd: false,
      });
    }
  }
})